package com.example.api.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.common.mybatis.gen.model.SysFunc;
import com.common.mybatis.gen.model.SysRole;
import com.example.api.dao.CustomUserMapper;
import com.example.api.entity.CustomUser;
import com.example.api.service.CustomSysUserService;

import io.swagger.annotations.Api;

@RequestMapping("/auth/api/user2")
@RestController
@Validated
@Api(description = "自定义查询user测试接口")
public class CustomUserController {

	@Autowired
	private CustomUserMapper customUserMapper;
	@Autowired
	private CustomSysUserService customSysUserServiceImpl;
	
	@GetMapping("/users")
  public List<CustomUser> users() {
    return customUserMapper.getCustomUsers();
  }
	
	@GetMapping("/roles/{id}")
  public List<SysRole> getUserRoles(@PathVariable("id") Integer id) {
		List<SysRole> roles = customSysUserServiceImpl.getUserSysRoles(id);
    return roles;
  }
	
	@GetMapping("/funcs/{id}")
  public List<SysFunc> getUserFuncs(@PathVariable("id") Integer id) {
		List<SysFunc> funcs = customSysUserServiceImpl.getUserSysFuncs(id);
    return funcs;
  }
	
	
}
